package cn.mesmile.workflow.process.vo;

import cn.mesmile.workflow.constant.WorkFlowConstant;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.flowable.task.api.Task;

import java.io.Serializable;
import java.util.Date;
import java.util.Map;

/**
 * @author zb
 * @Description
 */
@Data
public class ClaimTaskVO implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("任务id")
    private String taskId;

    @ApiModelProperty("流程实例id")
    private String processInstanceId;

    @ApiModelProperty("流程定义key，就是流程节点id")
    private String taskDefinitionKey;

    @ApiModelProperty("任务名称")
    private String name;

    @ApiModelProperty("values")
    private Map<String, Object> variables;

    @ApiModelProperty("审批人")
    private String assignee;

    @ApiModelProperty("分类")
    private String category;

    @ApiModelProperty("创建时间")
    private Date createTime;

    @ApiModelProperty("发起人")
    private String applyUser;

    @ApiModelProperty("发起人名称")
    private String applyUserName;

    @ApiModelProperty("执行id")
    private String executionId;

    @ApiModelProperty("到期时间")
    private Date dueDate;


    public ClaimTaskVO(Task task){
        this.taskId = task.getId();
        this.processInstanceId = task.getProcessInstanceId();
        this.taskDefinitionKey = task.getTaskDefinitionKey();
        this.name = task.getName();
        this.variables = task.getProcessVariables();
        this.assignee = task.getAssignee();
        this.category = task.getCategory();
        this.createTime = task.getCreateTime();
        this.executionId = task.getExecutionId();
        this.dueDate = task.getDueDate();
        this.applyUser = (String) variables.get(WorkFlowConstant.PROCESS_APPLY_USER);
        this.applyUserName = (String) variables.get(WorkFlowConstant.PROCESS_APPLY_USER_NAME);
    }

    public ClaimTaskVO(){}

}
